﻿@using HotelManageSystem.Models
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_LayoutInventroy.cshtml";
}
 <script type="text/javascript">

     function expandFirstRow(grid, row) {
         if (grid.$rows().index(row) == 0) {
             grid.expandRow(row);
         }
     }

     function productsIn_onRowDataBound(e) {
         var grid = $(this).data('tGrid');
         expandFirstRow(grid, e.row);
     }
    </script>
@(
 Html.Telerik().Grid<ProductInventoryModel>()
     .Name("ProductInventory")
     .Columns(columns=>
                  {
                      columns.Bound(p => p.Name).Title("货品名");
                      columns.Bound(p => p.ProductCategoy).Title("货品类别");
                      columns.Bound(p => p.InventroyCount).Title("库存");
                  })
                           .ClientEvents(events => events.OnRowDataBound("productsIn_onRowDataBound"))
                           .DetailView(inventoryDetailview => inventoryDetailview.ClientTemplate(
                           Html.Telerik().Grid<ProductInDetailModel>()
                               .Name("ProductId")
                           .Columns(columns =>
                                  {
                                      columns.Bound(p => p.DetailNumberIn);
                                      columns.Bound(p => p.InPrice);
                                      //columns.Bound(p => p.Count);
                                      //columns.Bound(p => p.Totail);
                                      //columns.Bound(p => p.Intime);
                                      //columns.Bound(p => p.EmployeeName);
                                      //columns.Bound(p => p.BinnName);
                                      //columns.Bound(p => p.ProductProviderName);
                                  })
                     .DataBinding(dataBinding => dataBinding.Ajax()
                                     .Select("GetProductIndetail", "ProductInventory", new { productID = "<#= ProductId #>" }))
                     //.Pageable()
                               //.Sortable()
                     //.Filterable()
                               //.Groupable()
                     .ToHtmlString()
                    )) 
           .DataBinding(dataBinding => dataBinding.Ajax().Select("Index", "ProductInventory"))
         .Pageable(paging => paging.PageSize(5))
         .Scrollable(scrolling => scrolling.Height(290))
         .Selectable()
         .Filterable()
         .Sortable()
         .Filterable()
         .Groupable())
